if(window.jQuery)(function($){
    $(document).ready(function(){
        $rsstab = $('<li class="page-item"><a title="RSS"><span>RSS</span></a></li>')
        .find('a')
        .css({
            'color':'#fff',
            'backgroundColor':'#fba430',
            'fontWeight':'900'
        })
        .attr('href','http://feeds2.feedburner.com/sexywp')
        .end()
        .css('float','right')
        .css('marginRight','0');
        $('ul.menu').append($rsstab);
        var $rsspanel;
        $('div.widget_text').each(function(){
            if ($(this).find('div.subscribe').size() > 0){
                $rsspanel = $(this);
                $rsspanel.find('h3').unbind('click');
            }
        });
        if ($rsspanel == null) return;
        $rsspanel.hide();
        var rsstab_pos = $rsstab.offset();
        $rsstab.mouseover(function(e){
            $rsspanel.find('ul').slideDown('fast').end()
            .fadeIn("fast").css('position','absolute')
            .css('left', rsstab_pos.left + $rsstab.width() - $rsspanel.outerWidth(true) +"px")
            .css('top', rsstab_pos.top + $rsstab.height() + 4 +"px");
            e.stopPropagation();
        });
        var hide_timer;
        var hide_rsspanel = function(){
            $rsspanel.fadeOut('fast');
        }
        $rsspanel.mouseover(function(e){
            clearTimeout(hide_timer);
            e.stopPropagation();
        }).click(function(e){
            e.stopPropagation();
        });
        $(document).mouseover(function(){
            if ($rsspanel.css('display') != 'none')
                hide_timer = setTimeout(hide_rsspanel, 1000);
        }).click(function(){
            if ($rsspanel.css('display') != 'none')
                hide_rsspanel();
        });
    });
})(jQuery);

